/* 
 * File:   File.h
 * Author: faraj
 *
 * Created on September 26, 2009, 7:32 AM
 */

#ifndef _FILE_H
#define	_FILE_H
#include "../CTools/CTools.h"


class File
{
private:
    CFile *cfile;
    string hash;
public:
    
    File(string filename)
    {
        md5wrapper md5;
        this->cfile = new CFile(filename);
        this->hash = md5.getHashFromFile(filename);
    }
    
    File(CFile *cf)
    {
        md5wrapper md5;
        this->cfile = cf;
        this->hash = md5.getHashFromFile(cfile->getPath());
    }
    string getHash()
    {
        return hash;
    }
    bool checkHash(string hashToChk)
    {
        return this->hash.compare(hashToChk.c_str());
    }
    
    string getPath()
    {
        return this->cfile->getPath();
    }
    
    bool deleteFile()
    {
        return cfile->deleteFile();
    }
};
#endif	/* _FILE_H */

